package ConnectionDB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionSorocabaFactory {

    private Connection conn;

    ConnectionSorocabaFactory() {

        try {
            this.conn = null;

            String url = "jdbc:postgresql://localhost:5431/SorocabaVerdeBD";
            String usuario = "usuario_comum_sorocaba";
            String senha = "senhaUsuario2012";

            Class.forName("org.postgresql.Driver");

            this.conn = DriverManager.getConnection(url, usuario, senha);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void closeConection() {
        try {
            this.conn.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }

    public Connection getConn() {
        return conn;
    }
}
